package com.msy.rmi;

import com.sun.jndi.rmi.registry.ReferenceWrapper;

import javax.naming.NamingException;
import javax.naming.Reference;
import java.rmi.AlreadyBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

/**
 * @author Msy
 * @Description
 * @createTime 2021年12月11日 16:34:00
 */
public class RMIServer {

    public static void main(String[] args) throws RemoteException, NamingException, AlreadyBoundException {
        Registry registry = LocateRegistry.createRegistry(8888);
        Reference reference=new Reference("com.msy.rmi.Execute","com.msy.rmi.Execute","http://192.168.18.203:8888");
        ReferenceWrapper referenceWrapper= new ReferenceWrapper(reference);
        registry.bind("maosuyu",referenceWrapper);
        System.out.println("Run on port 8888");
    }

}
